package taskDetail;

import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.jeecg.common.api.vo.Result;

@Api(tags = "任务详情")
@RestController
@RequestMapping("/taskDetail")
@Slf4j
public class TaskDetailController {
    @Autowired
    private ITaskDetailService iTaskDetailService;

    public Result<IPage<TaskDetail>> list(@RequestParam("gxProcess") String gxProcess, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime, @RequestParam("donePerson") String donePerson, @RequestParam("material") String material, @RequestParam("taskCode") String taskCode, @RequestParam("userName") String userName, @RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize) {
        /*
         * 根据用户代码查询用户角色，实现全局管理员和普通用户的权限控制（查询范围控制）,如果是管理员，就把用户名设置为空，
         * 在sql语句中where条件不生效，全局管理员就可以查询所有人的信息，而普通用户条件生效，只能查询自己的信息
         */
        userName = "";
        Result<IPage<TaskDetail>> result = new Result<>();
        IPage<TaskDetail> page = this.iTaskDetailService.list(gxProcess, donePerson, material, startTime, endTime, taskCode, userName, pageNo, pageSize);
        result.setResult(page);
        result.setSuccess(true);
        return result;
    }
}
